<?php
/**
 * 视图控制器
 */
namespace app\manage\controller\bonus;

use app\manage\controller\Base;

class Show extends Base
{

	public function _initialize(){
		parent::_initialize();
		$coinData = model('coin')::coinData();
		$levelData = model('level')::levelData();
		$this->assign('coinData',$coinData);
		$this->assign('levelData',$levelData);
	}

	public function index(){
		$pageData = [
			'title' => '奖金类型'
		];
		$this->assign('pageData',$pageData);
		return view();
	}

	public function record(){
		$params = $this->request->param();
        // 筛选参数
        $whereFields = ['page','start','end','effect_mid','reason_mid'];
        // 参数数组
        $whereData = [];
        foreach($whereFields as $field):
            if(isset($params[$field]))
                $whereData[$field] = $params[$field];
        endforeach;

		$pageData = [
			'title' => '奖金记录'
		];
		$this->assign('pageData',$pageData);
		$this->assign('whereData',$whereData);
		return view();
	}

	public function config(){

		$params = $this->request->param();
		$bonus_name = $params['name'];

		$bonus_arr = [
			'lingshou' => '零售利润',
			'xiaoshou' => '销售补贴',
			'fuwu' => '服务补贴',
			'guanli' => '管理补贴',
			'world' => '全体分红',
			'jiaquan'=> '加权分红'
		];

		$pageData = [
			'title' => $bonus_arr[$bonus_name],
		];
		$this->assign('pageData',$pageData);
		$this->assign('bonus_name',$bonus_name);
		return view('config_'.$bonus_name);

	}

}